package com.hundredapp.oa.web.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import com.hundredapp.oa.repository.ClassmngManager;
import com.hundredapp.oa.repository.UserManager;
import com.hundredapp.oa.repository.WorktimeManager;
import com.hundredapp.oa.vo.GraduationVO;
import com.opensymphony.xwork2.ActionSupport;

@Repository
@Scope("prototype")
public class Print  extends ActionSupport {
	
	private int classid;
	private int worktime;
	private String classname;
	private String worktimes;
	private String teacher;
	private List<GraduationVO> root;
	
	@Autowired
	private ClassmngManager classmng;
	@Autowired
	private WorktimeManager worktimemng;
	@Autowired
	private UserManager usermng;
	
	public String execute(){
		classname = classmng.findById(classid).getClassName();
		worktimes = worktimemng.findWorktimeById(worktime).getWorktime();
		teacher = usermng.findUserById(worktimemng.findWorktimeById(worktime).getCreateUserId()).getDisplayName();
		root=classmng.findGraduation(classid,worktime);
		return SUCCESS;
	}
	
	public List<GraduationVO> getRoot() {
		return root;
	}
	public void setClassid(int classid) {
		this.classid = classid;
	}

	public void setClassmng(ClassmngManager classmng) {
		this.classmng = classmng;
	}

	public int getWorktime() {
		return worktime;
	}

	public void setWorktime(int worktime) {
		this.worktime = worktime;
	}

	public String getClassname() {
		return classname;
	}

	public void setClassname(String classname) {
		this.classname = classname;
	}

	public String getWorktimes() {
		return worktimes;
	}

	public void setWorktimes(String worktimes) {
		this.worktimes = worktimes;
	}

	public String getTeacher() {
		return teacher;
	}

	public void setTeacher(String teacher) {
		this.teacher = teacher;
	}

}
